package br.com.positrot.model.log;

import java.util.HashMap;
import java.util.Map;

import br.com.crfutil.component.date.IntegerDate;
import br.com.positrot.model.vo.UsuarioVO;

public class CriterioPesquisaLog {
	
	private Form form;
	private Integer pid;
	private String numScreening;
	private UsuarioVO usuario;
	private IntegerDate dataInicial;
	private IntegerDate dataFinal;
	
	public Form getForm() {
		return form;
	}
	public void setForm(Form form) {
		this.form = form;
	}
	public Integer getPid() {
		return pid;
	}
	public void setPid(Integer pid) {
		this.pid = pid;
	}
	public String getNumScreening() {
		return numScreening;
	}
	public void setNumScreening(String numScreening) {
		this.numScreening = numScreening;
	}
	public UsuarioVO getUsuario() {
		return usuario;
	}
	public void setUsuario(UsuarioVO usuario) {
		this.usuario = usuario;
	}
	public IntegerDate getDataInicial() {
		return dataInicial;
	}
	public void setDataInicial(IntegerDate dataInicial) {
		this.dataInicial = dataInicial;
	}
	public IntegerDate getDataFinal() {
		return dataFinal;
	}
	public void setDataFinal(IntegerDate dataFinal) {
		this.dataFinal = dataFinal;
	}
	

	
	public Map<String, Object> criteriosSelecionados(){
		
		Map<String, Object> mapCriterios = new HashMap<String, Object>();
		
		if (form != null && form.getIdForm() != 0){
			mapCriterios.put("form", form);			
		}
		
		if (pid != null && pid.intValue() != 0){
			mapCriterios.put("pid", pid);
		}
		
		if (numScreening != null && !numScreening.trim().isEmpty()){
			mapCriterios.put("numScreening", numScreening.trim().toUpperCase());
		}
		
		if (usuario != null && usuario.getIdUsuario() != null && usuario.getIdUsuario() != 0 ){
			mapCriterios.put("usuario", usuario);
		}
		
		if (dataInicial != null && dataInicial.getStrDate()!= null && !dataInicial.getStrDate().isEmpty()){
			mapCriterios.put("dataInicial", dataInicial);
		}
		
		if (dataFinal != null && dataFinal.getStrDate() != null && !dataFinal.getStrDate().isEmpty()){
			mapCriterios.put("dataFinal", dataFinal);
		}

				
		return mapCriterios;
		
	}
	
}
